import { ExpeditionOrder } from './../../models/expeditionOrder';
import { Order } from './../../models/order';
import { AppStore } from './../../services/appStore';
import { Component, OnInit, Input, style } from '@angular/core';
import { OrderPriority } from "app/services";
import * as R from "ramda";

@Component({
    selector: 'expedition-order-display',
    styleUrls: ['./index.scss'],
    template: `
        <div class="expedition-order-display-contaniner layout-row" [class.active]="selected">
            <div class="serialNo layout-row layout-align-center-center">{{expeditionOrder.serialNo}}</div>  
            <div class="layout-column layout-align-center-start customerIdentities flex">
                <div class="customerIdentity" *ngFor="let customerIdentity of customerIdentities">{{customerIdentity}}</div>
            </div>
            <div class="time layout-row layout-align-center-center">
                <span>{{expeditionOrder.expediteBeginTime | date:'HH:mm'}}</span>
            </div>
            <div class="qty layout-row layout-align-center-center">
                <span class="number_tip">{{expeditionOrder.qty}}菜</span>
            </div>
        </div>
    `
})
export class ExpeditionOrderDisplay implements OnInit {
    @Input() expeditionOrder: ExpeditionOrder;
    @Input() selected: boolean;
    constructor(private appStore: AppStore) { }

    ngOnInit() {

    }

    get customerIdentities(){
        return R.uniq(this.expeditionOrder.items.map(item=>item.customerIdentity))
    }
}